<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of test_report
 *
 * @author miyzan
 */
class test_report extends MY_FPDF{
    //put your code here
    
    var $judul;

    function setJudul($value) {
        $this->judul = $value;
    }

    function getthbl($thbl) {
        $th = substr($thbl, 0, 4);
        $bl = substr($thbl, 4, 2);
        if ($bl == '01')
            $bl = 'Januari';
        else if ($bl == '02')
            $bl = 'Februari';
        else if ($bl == '03')
            $bl = 'Maret';
        else if ($bl == '04')
            $bl = 'April';
        else if ($bl == '05')
            $bl = 'Mei';
        else if ($bl == '06')
            $bl = 'Juni';
        else if ($bl == '07')
            $bl = 'Juli';
        else if ($bl == '08')
            $bl = 'Agustus';
        else if ($bl == '09')
            $bl = 'September';
        else if ($bl == '10')
            $bl = 'Oktober';
        else if ($bl == '11')
            $bl = 'Nopember';
        else if ($bl == '12')
            $bl = 'Desember';
        return $bl . ' ' . $th;
    }

    function Header() {

//Logo
        $this->Image($this->logourl, 3, 3, 15);

//Arial bold 15
        $this->SetFont('Arial', 'B', 12);
        $this->SetTextColor(1, 50, 155);
        $this->SetY(8);
        $this->Cell(13);
        $this->Cell(70, 5, $this->namasekolah, 0);
        $this->Cell(117, 5, '', 0);
        $this->Ln(5);
        $this->SetFont('Arial', 'B', 8);
        $this->Cell(13);
        $this->Cell(70, 3, $this->alamat, 0);


        $this->SetFont('Arial', 'I', 8);
        $this->SetY(8);
        $this->Cell(157);
        $this->Cell(20, 3, 'Tanggal Cetak', 0, 0, 'L');
        $this->Cell(3, 3, ':', 0, 0, 'C');
        $this->Cell(20, 3, date('d/m/Y'), 0, 0, 'R');
        $this->Ln(3);
        $this->Cell(157);
        $this->Cell(20, 3, 'Waktu Cetak', 0, 0, 'L');
        $this->Cell(3, 3, ':', 0, 0, 'C');
        $this->Cell(20, 3, date('h:i:s'), 0, 0, 'R');
        $this->Ln(3);
        $this->Cell(157);
        $this->Cell(20, 3, 'Halaman', 0, 0, 'L');
        $this->Cell(3, 3, ':', 0, 0, 'C');
        $this->Cell(20, 3, $this->PageNo() . ' dari {nb}', 0, 0, 'R');
//        $this->Ln();
        $this->SetDrawColor(1, 50, 155);
        $this->SetLineWidth(.25);
        $this->Line(5, 19, 205, 19);

        $this->Ln(6);

        $this->SetTextColor(0, 0, 0);
        $this->SetX(5);
        $this->SetFont('Arial', 'B', 10);
        $this->Cell(0, 5, $this->judul, 0, 0, 'C');
        $this->Ln();
        $this->SetX(5);
        $this->SetFont('Arial', '', 10);
        if (count($this->dataheader) > 0) {
            $this->Cell(0, 5, $this->dataheader[0], 0, 0, 'C');
            $this->Ln();
            $this->SetFont('Arial', '', 8);
            $this->Cell(0, 5, $this->dataheader[1], 0, 0, 'C');
            $this->Ln();
        } else {
            $this->Cell(0, 5, '', 0, 0, 'C');
            $this->Ln();
        }
        $this->Ln(5);
    }
    public function create_pdf($data){
        $this->AddPage();
        $this->Cell(30, 4, 'column header '.$this->GetY(), 1, 0, 'L');
        $this->Ln();
        foreach ($data as $value) {
            if($this->GetY()+4>272){
                $this->AddPage();
                $this->Cell(30, 4, 'column header '.$this->GetY(), 1, 0, 'L');
                $this->Ln();
            }
            if($value=='TEST 58'){
                $this->Cell(30, 4, $value.' '.$this->GetY(), 1, 0, 'L');
            }
            $this->Cell(30, 4, $value, 1, 0, 'L');
            $this->Ln();
        }
    }
    
}

?>
